{% extends "base/base.html" %}
{% load static %}
{% block css %}
    <link type="text/css" rel="stylesheet" href="{% static 'vendors/animate.css/animate.css' %}">
    <link type="text/css" rel="stylesheet" href="{% static 'vendors/jquery-pace/pace.css' %}">
    <link type="text/css" rel="stylesheet" href="{% static 'vendors/iCheck/skins/all.css' %}">
    <link type="text/css" rel="stylesheet" href="{% static 'vendors/jquery-notific8/jquery.notific8.min.css' %}">
    <link type="text/css" rel="stylesheet"
          href="{% static 'vendors/bootstrap-daterangepicker/daterangepicker-bs3.css' %}">
{% endblock %}
{% block right_menus %}
    <li><i class="fa fa-home"></i>&nbsp;<a href="{% url 'my_admin:list_channel' %}">首页</a>&nbsp;&nbsp;<i
            class="fa fa-angle-right"></i>
    </li>
    <li class="active">查看产品</li>
{% endblock %}
{% block page_title %}
    渠道列表
{% endblock %}
{{ request.menus }}
{% block context %}
    <form role="form" class="form-horizontal" method="get">
        <div class="row">
            <div class="col-md-4">
                <div class="form-group">
                    <label class="col-md-3 control-label">名称</label>
                    <div class="col-md-9">
                        <input type="text" placeholder="产品名称" class="form-control" name="name">
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="form-group">
                    <label class="col-md-3 control-label"></label>
                    <div class="col-md-9">
                        {#                        <input type="text" placeholder="产品编号" class="form-control">#}
                    </div>
                </div>
            </div>
            <div class="col-md-4">
                <div class="form-group">
                    <label class="col-md-3 control-label"></label>
                    <div class="col-md-9">
                        <input style="background-color: #00bcd4" type="submit" placeholder="Enter text"
                               class="form-control" value="搜索">
                    </div>
                </div>
            </div>
        </div>
    </form>

    <div class="row">
        <div class="col-lg-12">
            <div class="panel panel-blue">
                <div class="panel-heading" style="height: 51px;">{{channel_obj.name}}的产品列表
                    <a href="{% url 'my_admin:add_channel_product' channel_id %}">
                        <button style="float: right" type="button" class="btn btn-success">添加</button>
                    </a>
                    &nbsp
                    {#                    <button onclick="delete_data()" style="float: right; margin-right: 1%" type="button"#}
                    {#                            class="btn btn-warning">删除#}
                    {#                    </button>#}
                </div>


                <div class="panel-body">
                    <table class="table table-hover table-bordered">
                        <thead>
                        <tr>
                            <th width="3%">
                                <input type="checkbox" class="checkall"/>
                            </th>
                            <th>产品名称</th>
                            <th>渠道佣金</th>
                            <th>生效时间</th>
                            <th>查看</th>
                        </tr>
                        </thead>
                        <tbody>
                        {% for foo in products %}
                            <tr class="active">
                                <td>
                                    <input name="data_id" type="checkbox" value="{{ foo.id }}"/>
                                </td>
                                <th>{{ foo.product.name }}</th>
                                <th>{{ foo.sum_price }}</th>
                                <th>{{ foo.update_time | date:"Y-m-d" }}</th>
                                <th><a href="{% url 'my_admin:edit_channel_product' foo.id %}">查看</a></th>
                            </tr>

                        {% endfor %}
                        </tbody>
                    </table>
                    {% include "base/page.html" %}
                </div>

            </div>
        </div>
    </div>
{% endblock %}

{% block js %}
    <script>
        $(document).ready(function () {
            $("input[name='name']").val("{{ request.GET.name }}");
        });
    </script>

    <script>
        var delete_url = "";

    </script>
{% endblock %}